<?php
if(!defined('CMS'))die;
$title = sprintf(Eleanor::$Language['tpl']['average_mark'], round($average,2), $total);
$average = round($average,2);
if(!$total > 0) {
	$average = 0;
}
$u = uniqid('r');
$GLOBALS['jscripts'][]='js/rating.js';
?>
<div id="rating_main">
	<div id="jaunumi_one_record_reiting_text"><?= $r_lang ?></div>
	<div class="document_body_right_menu_reiting_cont jaunumi_one_record_reiting" title="<?= $title ?>" id="<?= $u ?>">
		<?php for ($i = 1; $i <= 5; $i++) : ?>
			<div class="document_body_right_menu_reiting<?=  $average >= $i ? ' red_star' : ' grey_star' ?>" data-now="<?= $i ?>"></div>
		<?php endfor ?>
	</div>
	<div id="jaunumi_one_record_reiting_numbers">
		<span><?= $average?></span>/<?= max($marks) ?>
	</div>
	<?php
		if ($can) :
	?>
	<script>
		/*<![CDATA[*/
		$(function(){
			new Rating("<?= $GLOBALS['Eleanor']->module['name']?>","#<?= $u?>",[<?=  join(',',$marks)?>]<?= (isset($addon) ? ','.Eleanor::JsVars($addon,false,true) : '')?>);
		});//]]>
	</script>
	<?php endif ?>
</div>